package com.weight.system.org.service.impl;

import com.weight.system.org.PO.OrgInfo;
import com.weight.system.org.service.OrgInfoService;
import com.weight.system.org.DAO.OrgInfoMapper;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import org.springframework.transaction.annotation.Transactional;
import com.weight.common.util.CommonUtils;
import lombok.extern.slf4j.Slf4j;

/**
 * 组织机构信息表
 */
@Service
@Transactional
@Slf4j
public class OrgInfoServiceImpl implements OrgInfoService {

	@Autowired
	private OrgInfoMapper orgInfoMapper;


	/**
	 * 查询组织机构信息信息--条件查询
	 * @param map
	 * @return
	 */
	@Override
	public List<OrgInfo> findOrgInfoByT(Map map){
		return orgInfoMapper.findOrgInfoByT(map);
	}

	/**
	 * 查询组织机构信息信息--条件，分页查询
	 * @param currentPage
	 * @param pageSize
	 * @param map
	 * @return
	 */
	@Override
	public List<OrgInfo> findOrgInfoByPage(int currentPage,int pageSize,Map map){
		PageHelper.startPage(currentPage, pageSize);
		List<OrgInfo> orgInfoList = orgInfoMapper.findOrgInfoByT(map);
		return orgInfoList;
	}

	/**
	 * 查询组织机构信息信息--查询全部
	 * @return
	 */
	@Override
	public List<OrgInfo> findAll(){
		return orgInfoMapper.findAll();
	}

	/**
	 * ID查询组织机构信息信息
	 * @param map
	 * @return
	 */
	@Override
	public OrgInfo findByOrgInfoId(Map map){
		OrgInfo orgInfo=orgInfoMapper.findByOrgInfoId(map);
		CommonUtils.validateExistObj(orgInfo,map);
		return orgInfo;
	}

	/**
	 * ID查询组织机构信息信息-批量
	 * @param orgInfoIdList
	 * @return
	 */
	@Override
	public List findByOrgInfoIdList(List orgInfoIdList){
		List idList = orgInfoMapper.findByOrgInfoIdList(orgInfoIdList);
		CommonUtils.validateExistList(idList,orgInfoIdList);
		return idList;
	}

	/**
	 * 添加组织机构信息
	 * @param orgInfo
	 */
	@Override
	public void insertOrgInfo(OrgInfo orgInfo){
		orgInfoMapper.insertOrgInfo(orgInfo);
	}

	/**
	 * 批量添加组织机构信息
	 * @param orgInfoList
	 */
	@Override
	public void insertOrgInfoBatch(List<OrgInfo> orgInfoList){
		orgInfoMapper.insertOrgInfoBatch(orgInfoList);
	}

	/**
	 * 修改组织机构信息
	 * @param orgInfo
	 */
	@Override
	public void updateOrgInfo(OrgInfo orgInfo){
		orgInfoMapper.updateOrgInfo(orgInfo);
	}

	/**
	 * 修改组织机构信息
	 * @param orgInfo
	 */
	@Override
	public void updateOrgInfoLimt(OrgInfo orgInfo){
		orgInfoMapper.updateOrgInfoLimt(orgInfo);
	}

	/**
	 * 物理删除组织机构信息
	 * @param map
	 */
	@Override
	public void deleteByOrgInfoId(Map map){
		orgInfoMapper.deleteByOrgInfoId(map);
	}

	/**
	 * 批量物理删除组织机构信息
	 * @param orgInfoIdList
	 */
	@Override
	public void deleteByOrgInfoIdBatch(List orgInfoIdList){
		orgInfoMapper.deleteByOrgInfoIdBatch(orgInfoIdList);
	}

	/**
	 * 状态删除组织机构信息
	 * @param map
	 */
	@Override
	public void upDelByOrgInfoId(Map map){
		orgInfoMapper.upDelByOrgInfoId(map);
	}

	/**
	 * 批量状态删除组织机构信息
	 * @param orgInfoList
	 */
	@Override
	public void upDelByOrgInfoIdBatch(Map<String, Object> map){
		orgInfoMapper.upDelByOrgInfoIdBatch(map);
	}

}